import { ref } from 'vue'
import { defineStore } from 'pinia'

export const UserInfoStore = defineStore("UserInfoStore", ()=>{
  const info = ref({
    userId: -1,
    userName: "xxx",
    state: false
  })

  const setUserId = (userId) => {info.value.userId = userId}
  const setUserName = (userName) => {info.value.userName = userName}
  const setState = (state) => {info.value.state = state}

  const getUserId = () => {return info.value.userId}
  const getUserName = ()=>{return info.value.userName}

  const getState = () => {return info.value.state}

  return {setUserId, setUserName, getUserId, getUserName, setState, getState}
})
